package com.vivianwei.sqlfix;

import cn.hutool.db.Db;
import cn.hutool.db.Entity;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * @Description
 * @Author wangwei
 * @Date2021/3/11 4:52 下午
 * @Version V1.0
 **/
public class TableComments extends SqlProcess{

    public TableComments(List<String> tables, String excelPath, String genPath, String sheetName) {
        super(tables, excelPath, genPath, sheetName);
    }

    protected String sql(Map line) throws SQLException {
        List<Entity> list = Db.use((String) line.get("数据库名称")).query("select table_comment  from information_schema.TABLES \n" +
                        "where table_schema = ? and table_name = ?  ", line.get("数据库名称"),line.get("数据表名"));
        String tableComment = (String) list.get(0).get("table_comment");
        System.out.println(tableComment);
        return null;
    }
}
